/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file    can.h
  * @brief   This file contains all the function prototypes for
  *          the can.c file
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2024 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __CAN_H__
#define __CAN_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"


/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

extern CAN_HandleTypeDef hcan2;

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

void MX_CAN2_Init(void);

void CAN2_Send_Msg(uint8_t nodeId, uint8_t* msg, uint8_t len);


//灯控-IO处理先关定义
//命令宏
#define IO_ORDER_RED        (0x01)//红
#define IO_ORDER_YELLOW     (0x02)//黄
#define IO_ORDER_GREEN      (0x04)//绿
//控制宏
#define IO_CONTROL_SET      (0x01)
#define IO_CONTROL_RESET    (0x00)

//IO 扩展板
//功能码
#define EXTEND_FUN_READ     (0x04)//读命令
#define EXTEND_FUN_WRITE    (0x05)//写命令
//地址
#define EXT_ADDR_OUT_PORT   (0x3100)//输出基地址
#define EXT_ADDR_IN_PORT    (0x3200)//输入基地址

extern uint8_t mIO_Order;//命令数据 bit0-红，bit1-黄，bit2-绿
extern uint8_t mIO_Data;//控制数据

extern uint8_t CAN2_RxData[10];//CAN2接收数据buf

void EXT_IO_Process(void);//灯处理函数
//灯控-IO处理先关定义

/* USER CODE BEGIN Prototypes */

/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __CAN_H__ */

